#!/usr/bin/python3
# coding=utf-8
from pytdx.hq import TdxHq_API
from pytdx.params import TDXParams

api = TdxHq_API()
code='002727'

if api.connect('119.147.212.81', 7709):
    data = api.get_company_info_content(TDXParams.MARKET_SH, code, code+'.txt', 0, 12976)#返回一心堂信息详情
    f = "../data/txt/"+code+"_f.txt"
    # 打开文件
    with open(f, "w", encoding='utf-8') as f:
        # write()：将内容写入文件，默认不换行
        f.write(data)
    print(data)
    api.disconnect()